var ssqy = "HM";
var btncount = 1; //全局变量用来记录是全景周边还是3d楼盘
var arrayallguid = [];
var array = [];
var array1;
var promisehouse;
var buildingInfo = {};
var resu1;
var promisemodellczx; //乐成中心新增的一栋楼图层{buildingId:buildid,page:"1",size:"9900"}
setTimeout(function() {
  ajax(
    "/api/v1/building/buildingHomeRentSpace",
    "POST",
    { buildingId: buildid, page: "1", size: "9900" },
    function(result) {
      if (result.code == 200) {
        resu1 = result;
        for (var i = 0; i < result.data.list.length; i++) {
          arrayallguid.push(result.data.list[i].roomNo);
        }
        if (commname != "" || dzc_service != undefined) {
          gethousehold(arrayallguid);
        }
      } else {
        alert("失败！！！");
      }
    },
    false
  );
}, 100);
var buildingName = "";
setTimeout(function() {
  //房源待租空间
  fy();
  //楼盘图片
  ajax(
    "/api/v1/building/getBuildingOutDoorPic",
    "POST",
    { buildingId: buildid },
    function(result) {
      if (result.code == 200) {
        if (result.data.length > 0) {
          buildingInfo.img = getDefaultImg(result.data[0].imgUrl);
          for (var i = 0; i < result.data.length; i++) {
            $("#piclist").append(
              '<div class="swiper-slide">' +
                "<a href=" +
                getDefaultImg(result.data[i].imgUrl) +
                ' data-size="1024x1024"><img src=' +
                getDefaultImg(result.data[i].imgUrl) +
                " /></a>" +
                '<figcaption itemprop="caption description">' +
                getDefaultImg(result.data[i].imgUrl) +
                "</figcaption>" +
                "</div>"
            );
          }
        } else {
          $("#piclist").append(
            '<div class="swiper-slide">' +
              "<a href='static/images/noupload.png' data-size='1024x1024'><img src='static/images/noupload.png' /></a>" +
              '<figcaption itemprop="caption description">' +
              "</figcaption>" +
              "</div>"
          );
          buildingInfo.img = getDefaultImg("static/images/noupload.png");
        }

        setTimeout(function() {
          var mySwiper = new Swiper(".swiper-threed", {
            autoplay: true,
            direction: "horizontal",
            pagination: {
              el: ".swiper-pagination",
              type: "custom"
            }
          });
        }, 1000);
      } else {
        alert("失败！！！");
      }
    },
    false
  );

  //楼盘信息
  ajax(
    "/api/v1/building/getBuildingInfo",
    "POST",
    { buildingId: buildid },
    function(result) {
      if (result.code == 200) {
        buildingInfo.title = result.data.buildingName;
        buildingInfo.desc =
          result.data.price +
          " 元/m²/天\n" +
          result.data.minArea +
          "m²~" +
          result.data.maxArea +
          "m²在租";
        doShare(buildingInfo.title, buildingInfo.desc, buildingInfo.imgUrl);
        longitude = result.data.longitude;
        latitude = result.data.latitude;
        point1 = new BMap.Point(parseFloat(longitude), parseFloat(latitude));
        map.centerAndZoom(point1, 16);
        var myIcon = new BMap.Icon(
          "http://api.map.baidu.com/img/markers.png",
          new BMap.Size(23, 25),
          {
            offset: new BMap.Size(10, 25), // 指定定位位置
            imageOffset: new BMap.Size(0, 0 - 10 * 25) // 设置图片偏移
          }
        );

        var marker = new BMap.Marker(point1, { icon: myIcon });
        //marker.setLabel(new BMap.Label(result.data.buildingName));
        map.addOverlay(marker);
        $(".map").on("click", function() {
          location.href = "bdmap.html?name=" + result.data.buildingName;
        });
        /*$('.map').on('touchstart', function () {
	                location.href = "bdmap.html?name="+result.data.buildingName;
	            });*/
        $("#price").html(result.data.price);
if(result.data.price == 0){
$("#jiage").html("暂无")；
}else{
$("#price").html(result.data.price);
}
    
        buildingName = result.data.buildingName;
        $("#tit").html(result.data.buildingName);
        $("#addre").html(result.data.townName + result.data.tradingArea);
        $("#address").html(result.data.address);
        $("#jcnd1").html(result.data.buildingYear);
        $("#jcnd").html(result.data.buildingYear + "年");
        $("#jzmj").html(result.data.totalArea + "m²");
        $("#sssq").html(result.data.tradingArea);
        $("#ldsl").html(result.data.totalNum);
        $("#szhx").html(result.data.loopName);
        $("#zglc").html(result.data.totalFloors);
        $("#kfs").html(result.data.developer);
        $("#lpdz").html(result.data.address);
        $("#ktsl").html(result.data.elevatorNum);
        $("#tcss").html(
          "地下停车位 :" +
            result.data.underParking +
            "、地上停车位:" +
            result.data.overParking
        ); //停车设施
        $("#ktxt").html(result.data.airConditioning);
        $("#rzqy").html(result.data.inCompanys);
        $("#wygs").html(result.data.managementCompany);
        $("#wyf").html(result.data.managementFee + "元/m² · 天");
        $("#tsfw").html(result.data.featureService);
        $("#lpjs").html(result.data.buildingIntroduce);
        var temp = latitude + "," + longitude;
        var bd =
          "http://api.map.baidu.com/direction?origin=latlng:" +
          temp +
          "|name:我的位置&destination=" +
          result.data.address +
          "&mode=driving&region=北京&output=html&src=webapp.baidu.openAPIdemo";
        //window.location.href = 'http://api.map.baidu.com/marker?location=40.047669,116.313082&title=我的位置&content=百度奎科大厦&output=html&src=webapp.baidu.openAPIdemo';
        document.getElementById("daohang1").setAttribute("href", bd);
        /*document
          .getElementById("daohang1")
          .setAttribute("href", "baidu.html?name=" + result.data.address);*/
        document
          .getElementById("phone")
          .setAttribute("href", "tel:" + result.data.tel1);
        document.getElementById("wygs").title = result.data.managementCompany;
        document.getElementById("wyf").title =
          result.data.managementFee + "元/m² · 天";
        document.getElementById("tsfw").title = result.data.featureService;
      } else {
        alert("失败！！！");
      }
    },
    false
  );
  $("#phone").on('click',function(){
    buildingId = getParams('buildid')
    ajax(
      "/api/v1/consult/append",
      "POST",
      { type: '3', resourceId: buildingId },
      function(result) {
        if (result.code == 200) {
          yzx = result.data.num;
        }
      },
      false
    );
  })
  //获取关注人数
  ajax(
    "/api/v1/user/opt/attentionTypeNum",
    "POST",
    { type: 1, id: buildid },
    function(result) {
      if (result.code == 200) {
        $("#guanzhu").html(result.data + "人关注");
      } else {
        alert("失败！！！");
      }
    },
    false
  );
  //获取此楼盘是否被此用户关注
  ajax(
    "/api/v1/user/opt/checkAttention",
    "POST",
    { type: 1, id: buildid },
    function(result) {
      if (result.code == 200) {
        if (result.data.isAttention == 0) {
          //没有被关注
          $("#lpgz").html("关  注");
        } else {
          //关注了
          $("#lpgz").html("已关注");
        }
      }
    },
    false
  );
  //点击关注
  $("#guanzhulp").click(function() {
    var cookie = getCookie("signature");
    if (cookie) {
      if ($("#lpgz").html() == "已关注") {
        //取消关注
        ajax(
          "/api/v1/user/opt/delAttention",
          "POST",
          { attentionType: 1, id: buildid },
          function(result) {
            $("#lpgz").html("关  注");
          },
          false
        );
      } else {
        ajax(
          "/api/v1/user/opt/addAttention",
          "POST",
          { attentionType: 1, id: buildid },
          function(result) {
            $("#lpgz").html("已关注");
          },
          false
        );
        $("#lpgz").html("已关注");
      }
    } else {
      window.location.href = "/console/#/Login";
    }
  });
  //添加浏览量
ajax(
  "/api/v1/user/opt/addVisit",
  "POST",
  { id: getParams('buildid'), type: "1" },
  function(result) {
    if (result.code == 200) {
      //$("#fyyll").html(result.data);
    }
  },
  false
);
  //楼盘周边推荐推荐
  ajax(
    "/api/v1/building/recommendedBuildingNearby",
    "POST",
    { buildingId: buildid },
    function(result) {
      if (result.code == 200&&result.data != null) {
        for (var i = 0; i < result.data.length; i++) {
          if (result.data[i].directFlag == 1) {
            var directFlag = "直租计划";
          } else {
            var directFlag = "";
          }
          var imgThree =
            result.data[i].buildingFlag == 1 ? "static/images/3D.svg" : "";
          if (
            result.data[i].imgUrl == null ||
            result.data[i].imgUrl == "undefined" ||
            result.data[i].imgUrl == "null"
          ) {
            $("#zbtj").after(
              '<div class="out" id="' +
                result.data[i].buildingId +
                '" onclick=zbtjlp("' +
                result.data[i].building3dCode +
                '","' +
                result.data[i].buildingId +
                '")>' +
                '<div class="more-house-list">' +
                '<div class="pic">' +
                '<a href="javascript:;"><img src=' +
                imgThree +
                "></a>" +
                '<img src="static/images/noupload.png">' +
                "</div>" +
                '<div class="remark aui-clearfix">' +
                '<div class="line-1 aui-ellipsis-1">' +
                result.data[i].buildingName +
                "</div>" +
                '<div class="aui-info">' +
                '<div class="aui-info-item"><small>' +
                result.data[i].minArea +
                "m²-" +
                result.data[i].maxArea +
                "m²在租</small></div>" +
                "</div>" +
                '<div class="aui-info">' +
                '<div class="aui-info-item zhizu-plan"><small>' +
                directFlag +
                "</small></div>" +
                '<div class="aui-info-item"><big>' +
                result.data[i].price +
                "</big><small> 元/m²·天</small></div>" +
                "</div>" +
                "</div>" +
                "</div>" +
                "</div>"
            );
          } else {
            $("#zbtj").after(
              '<div class="out" id="' +
                result.data[i].buildingId +
                '" onclick=zbtjlp("' +
                result.data[i].building3dCode +
                '","' +
                result.data[i].buildingId +
                '")>' +
                '<div class="more-house-list">' +
                '<div class="pic">' +
                '<a href="javascript:;"><img src=' +
                imgThree +
                "></a>" +
                '<img src="' +
                getDefaultImg(result.data[i].imgUrl) +
                '">' +
                "</div>" +
                '<div class="remark aui-clearfix">' +
                '<div class="line-1 aui-ellipsis-1">' +
                result.data[i].buildingName +
                "</div>" +
                '<div class="aui-info">' +
                '<div class="aui-info-item"><small>' +
                result.data[i].minArea +
                "m²-" +
                result.data[i].maxArea +
                "m²在租</small></div>" +
                "</div>" +
                '<div class="aui-info">' +
                '<div class="aui-info-item zhizu-plan"><small>' +
                directFlag +
                "</small></div>" +
                '<div class="aui-info-item"><big>' +
                result.data[i].price +
                "</big><small> 元/m²·天</small></div>" +
                "</div>" +
                "</div>" +
                "</div>" +
                "</div>"
            );
          }
        }
      } else {
        alert("失败！！！");
      }
    },
    false
  );
}, 400);
fy();
//周边推荐跳转链接
function zbtjlp(buildname, buildid) {
  window.location.href =
    "loupan.html?name=" + buildname + "&cnt=0&buildid=" + buildid;
}
function toSearch() {
  window.open(
    "/item/views/search/search-result-house.html?keyword=" + buildingName
  );
}
function onload(Cesium) {
  if (commname != "" && dzc_service != undefined) {
    viewer = new Cesium.Viewer("scenediv", {
      terrainProvider: new Cesium.CesiumTerrainProvider({
        url: dzc_service.serverurllayers.terrain,
        requestWaterMask: true, //是否请求水面标志位（用于水面特效），默认不请求
        requestVertexNormals: true, //是否请求法线（用于光照效果），默认不请求
        isSct: true //是否为iServer发布的TIN地形服务
      })
    });
    scene = viewer.scene;
    imageryLayers = viewer.imageryLayers;

    //添加影像
    var imageryProvider1 = new Cesium.SuperMapImageryProvider({
      url: dzc_service.serverurllayers.imageWhiteBase
    });
    var widget = viewer.cesiumWidget;
    imageryLayers.addImageryProvider(imageryProvider1);
    var imageryProviderdom = new Cesium.SuperMapImageryProvider({
      url: dzc_service.serverurllayers.Dom["HM"]
    });
    layerdom = imageryLayers.addImageryProvider(imageryProviderdom);
    layerdom.show = false;
    scene.screenSpaceCameraController.enableZoom = false;
    scene.sun.show = false;
    //添加鼠标移动事件，功能实现指北针方位和场景方位一致
    var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
    handler.setInputAction(function(movement) {
      var heading = scene.camera.heading;
      var ss = (heading * 180) / 3.14;
      document.getElementById("img1").style.transform =
        "rotate(" + -ss + "deg)";
    }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
    viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(
      Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
    );
    if (cnt == 0) {
      promisemodel = scene.addS3MTilesLayerByScp(
        dzc_service.serverurllayers.Model["HM"],
        {
          name: "model"
        }
      );
      promisemodel12 = scene.addS3MTilesLayerByScp(
        dzc_service.serverurllayers.Model["HM12"],
        {
          name: "model12"
        }
      );
      if (commname == "BJCY010" || commname == "乐成中心") {
        promisemodellczx = scene.addS3MTilesLayerByScp(
          dzc_service.serverurllayers.Model["LCZX"],
          {
            name: "modellczx"
          }
        );
        promisemodellczx.then(function(layer) {
          layer.selectEnabled = false;
          layer.visible = false;
        });
      }
      promisemodel12.then(function(layer) {
        layer.selectEnabled = false;
        layer.visible = false;
      });
      promisemodel.then(function(layer) {
        layer.selectEnabled = false;
        layer.visible = true;
        $("#ditu").css({ display: "none" });
        $("#gif").css({ display: "none" });
      });
      promisehouse = scene.addS3MTilesLayerByScp(
        dzc_service.serverurllayers.Household,
        {
          name: "household"
        }
      );
      /* promisehouse.then(function(layer){
		 	layer.setQueryParameter({//设置查询参数
		         url: dataurl,
		         dataSourceName: 'AttachData',//数据源
		         dataSetName: 'Household',//数据集
		     });
		 	layer._selectColorType = 1;
		 	layer.selectEnabled = true;
		 	layer.visible = true;
		 });*/
      if (array != undefined && array.length > 0 && array != "undefined") {
        promisehouse.then(function(layer) {
          layer._selectColorType = 1;
          layer.selectEnabled = true;
          layer.visible = true;
          layer.setObjsVisible(array, true);
          layer.setObjsColor(
            array,
            new Cesium.Color(0, 139 / 255, 210 / 255, 1)
          );
        });
      } else {
        promisehouse.then(function(layer) {
          layer._selectColorType = 1;
          layer.selectEnabled = true;
          layer.visible = false;
          //layer.setObjsVisible(array,true);
          //layer.setObjsColor(array,new Cesium.Color(0,139/255,210/255,1));
        });
      }

      if (btncount == 0) {
        Range = 474;
        var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
          Cesium.Cartesian3.fromDegrees(
            center.x - 0.00000000045916,
            center.y,
            tranheight
          )
        );
        var heading = Cesium.Math.toRadians(parseInt(lpheading));
        var pitch = Cesium.Math.toRadians(-35.0);
        var range = 474.0;
        scene.camera.lookAtTransform(
          transform,
          new Cesium.HeadingPitchRange(heading, pitch, range)
        );
      } else {
        Range = range1;
        var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
          Cesium.Cartesian3.fromDegrees(
            center.x - 0.00000000045916,
            center.y,
            tranheight
          )
        );
        var heading = Cesium.Math.toRadians(Number(lpheading));
        var pitch = Cesium.Math.toRadians(pitchcsh);
        var range = range1;
        scene.camera.lookAtTransform(
          transform,
          new Cesium.HeadingPitchRange(heading, pitch, range)
        );
      }
    }

    huadong(); //滑动房源信息调用方法
    louhao(); //初始化展示出楼号
  } else {
    $("#scenediv").css({ display: "none" });
    $("#ditu").css({ display: "none" });
    $("#gif").css({ display: "none" });
    $("#model3d").css({ display: "none" });
    $("#tp").addClass("active");
    $(".three-d-invisible").css({ display: "none" });
  }
}
//鼠标拖动房源，最做边的房源在三维场景中显示出黄色
function huadong() {
  var values = [];
  var value1 = [];
  for (var i = 0; i < $("#fjhlist .swiper-slide").length; i++) {
    if (
      $("#fjhlist .swiper-slide")[i].className ==
      "swiper-slide swiper-slide-active"
    ) {
      var id = $("#fjhlist .swiper-slide")[i].id;
      id = id.replace("[", "");
      id = id.replace("]", "");
      var arr = id.split(",");
      for (var j = 0; j < arr.length; j++) {
        var f = arr[j];
        values.push(f);
      }
    } else {
      var id = $("#fjhlist .swiper-slide")[i].id;
      id = id.replace("[", "");
      id = id.replace("]", "");
      var arr = id.split(",");
      for (var j = 0; j < arr.length; j++) {
        var f = arr[j];
        value1.push(f);
      }
    }
    if (promisehouse != null && promisehouse != "") {
      promisehouse.then(function(layer) {
        if (values > 0 || value1 > 0) {
          layer.visible = true;
        }
        layer.setObjsColor(values, Cesium.Color.YELLOW);
        layer.setObjsColor(
          value1,
          new Cesium.Color(0, 139 / 255, 210 / 255, 1)
        );
      });
    }
  }
}
//根据房源id查询出空间库中smid
function gethousehold(value) {
  if (value.length > 0) {
    var str = "(";
    var fjh = value.toString();
    var f = [];
    f = fjh.split(",");
    for (var j = 0; j < f.length; j++) {
      if (j < f.length - 1) {
        str = str + " RoomNo = '" + f[j] + "' or";
      } else if (j == f.length - 1) {
        str = str + " RoomNo = '" + f[j] + "'";
      } else {
        str = str;
      }
    }
    var string = "";
    str += ") and LPBH = '" + commname + "'";
    //var count=value.length;
    var sql = str;
   if(dzc_service != undefined){
 var queryconfig = {
      url: dataurl,
      sql: sql,
      layerName: dzc_service.layers.layerhousehold,
      datalayerName: dzc_service.datalayers.layerhousehold,
      callback: processCompletedhouse
    };
    _queryBySql(queryconfig);
}
  }
}
function processCompletedhouse(getFeaturesEventArgs) {
  array = [];
  array1 = [];
  var list = getFeaturesEventArgs.originResult.features;
  var count = getFeaturesEventArgs.originResult.featureCount;
  for (var j = 0; j < list.length; j++) {
    var smid = getFeaturesEventArgs.originResult.features[j].ID;
    var housefh = getFeaturesEventArgs.originResult.features[j].fieldValues[30];
    array.push(smid);
    array1.push(housefh);
  }
  /*if(count > 0 ){
		promisehouse.then(function(layer){
		 	layer._selectColorType = 1;
		 	layer.selectEnabled = true;
		 	layer.visible = true;
		 	layer.setObjsVisible(array,true);
			layer.setObjsColor(array,new Cesium.Color(0,139/255,210/255,1));
		 });
	}*/

  //$("#smid").val("["+array+"]");
}
//3D楼盘展示出楼号
function louhao() {
  $.ajax({
    url: "js/js/marker.json",
    type: "GET",
    dataType: "json",
    async: false,
    success: function(data) {
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].louhao.length; j++) {
            var temp = data[i].datas[0].louhao[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            viewer.entities.add({
              id: data[i].datas[0].louhao[j].id,
              name: data[i].datas[0].louhao[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              label: {
                //文字标签
                text: data[i].datas[0].louhao[j].text,
                outlineWidth: 0,
                outlineColor: Cesium.Color.WHITE,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.WHITE,
                font: "18px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(0, -9) //偏移量
              }
            });
          }
        }
      }
    }
  });
}
//全景周边中标注
function mark() {
  $.ajax({
    url: "js/js/marker.json",
    type: "GET",
    dataType: "json",
    async: false,
    success: function(data) {
      //添加文字和图片
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].wenimg.length; j++) {
            var temp = data[i].datas[0].wenimg[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var temp1 = data[i].datas[0].wenimg[j].pixelOffset;
            var result1 = temp1.split(",");
            if (result1.length > 0) {
              var left = result1[0];
              var right = result1[1];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].wenimg[j].id,
              name: data[i].datas[0].wenimg[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              billboard: {
                image: data[i].datas[0].wenimg[j].billboard,
                width: 32,
                height: 32
              },
              label: {
                //文字标签
                text: data[i].datas[0].wenimg[j].text,
                outlineWidth: 0,
                outlineColor: Cesium.Color.YELLOW,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.YELLOW,
                font: "15px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.LEFT, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(
                  parseFloat(left),
                  parseFloat(right)
                ) //偏移量
              }
            });
          }
        }
      }

      //添加楼号
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].louhao.length; j++) {
            var temp = data[i].datas[0].louhao[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].louhao[j].id,
              name: data[i].datas[0].louhao[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              label: {
                //文字标签
                text: data[i].datas[0].louhao[j].text,
                outlineWidth: 0,
                outlineColor: Cesium.Color.WHITE,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.WHITE,
                font: "18px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(0, -9) //偏移量
              }
            });
          }
        }
      }
      //添加文本
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].wenben.length; j++) {
            var temp = data[i].datas[0].wenben[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].wenben[j].id,
              name: data[i].datas[0].wenben[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              label: {
                //文字标签
                text: data[i].datas[0].wenben[j].text,
                outlineWidth: 0,
                outlineColor: Cesium.Color.YELLOW,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.YELLOW,
                font: "15px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(0, -9) //偏移量
              }
            });
          }
        }
      }
      //添加道路
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].daolu.length; j++) {
            var temp = data[i].datas[0].daolu[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].daolu[j].id,
              name: data[i].datas[0].daolu[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              label: {
                //文字标签
                text: data[i].datas[0].daolu[j].text,
                outlineWidth: 1,
                outlineColor: Cesium.Color.LIME,
                showBackground: true,
                backgroundColor: new Cesium.Color(0, 0, 0, 0.4),
                fillColor: Cesium.Color.LIME,

                font: "15px SimHei",
                verticalOrigin: Cesium.VerticalOrigin.BOTTOM, //垂直方向以底部来计算标签的位置
                pixelOffset: new Cesium.Cartesian2(0, -9) //偏移量
              }
            });
          }
        }
      }
      for (var i = 0; i < data.length; i++) {
        if (commname == data[i].name) {
          for (var j = 0; j < data[i].datas[0].img.length; j++) {
            var temp = data[i].datas[0].img[j].position;
            var result = temp.split(",");
            if (result.length > 0) {
              var long = result[0];
              var lat = result[1];
              var height = result[2];
            }
            var citizensBankPark = viewer.entities.add({
              id: data[i].datas[0].img[j].id,
              name: data[i].datas[0].img[j].name,
              position: Cesium.Cartesian3.fromDegrees(
                parseFloat(long),
                parseFloat(lat),
                parseFloat(height)
              ),
              billboard: {
                //图标
                image: data[i].datas[0].img[j].image,
                width: 32,
                height: 32
              }
            });
          }
        }
      }
    }
  });
}
/**
 * 放大按钮：根据相机的拉近，实现模型的放大效果
 */
function add() {
  $("#fy").attr("src", "images/fuyuan.png");
  $("#fd").attr("src", "images/fda1.png");
  $("#sx").attr("src", "images/suoxiao.png");
  var heading, pitch;
  if (btncount == 0) {
    heading = scene.camera.heading;
    //pitch = Cesium.Math.toRadians(-35.0);
    pitch = scene.camera.pitch;
  } else {
    heading = scene.camera.heading;
    //pitch = Cesium.Math.toRadians(-5.0);
    pitch = scene.camera.pitch;
  }
  var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(
      center.x - 0.00000000045916,
      center.y,
      tranheight + 10
    )
  );
  if (Range < 475 && Range > Rangeheight) {
    Range = Range - 30;
    scene.camera.lookAtTransform(
      transform,
      new Cesium.HeadingPitchRange(heading, pitch, Range)
    );
  } else {
    if (Range > 455) {
      Range = 455;
      scene.camera.lookAtTransform(
        transform,
        new Cesium.HeadingPitchRange(heading, pitch, Range)
      );
    } else if (Range < Rangeheight) {
      Range = Rangeheight;
    } else {
      Range = Rangeheight;
    }
  }
}
/**
 * 缩小按钮：根据相机的远离，使看到的模型缩小
 */
function reduce() {
  var heading, pitch;
  if (btncount == 0) {
    heading = scene.camera.heading;
    //pitch = Cesium.Math.toRadians(-35.0);
    pitch = scene.camera.pitch;
  } else {
    heading = scene.camera.heading;
    //pitch = Cesium.Math.toRadians(-5.0);
    pitch = scene.camera.pitch;
  }
  $("#fy").attr("src", "images/fuyuan.png");
  $("#fd").attr("src", "images/fangda.png");
  $("#sx").attr("src", "images/sxiao1.png");
  var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(
      center.x - 0.00000000045916,
      center.y,
      tranheight + 10
    )
  );
  if (Range <= 455 && Range >= Rangeheight) {
    Range = Range + 30;
    scene.camera.lookAtTransform(
      transform,
      new Cesium.HeadingPitchRange(heading, pitch, Range)
    );
  } else {
    if (Range > 455) {
      Range = 455;
    } else {
      Range = Rangeheight;
      scene.camera.lookAtTransform(
        transform,
        new Cesium.HeadingPitchRange(heading, pitch, Range)
      );
    }
  }
}
/**
 * 复原按钮：初始化场景中相机的方位角和高度
 */
function reset() {
  $("#fy").attr("src", "images/hyuan1.png");
  $("#fd").attr("src", "images/fangda.png");
  $("#sx").attr("src", "images/suoxiao.png");

  Value = 202;
  var pitch;
  if (btncount == 0) {
    pitch = Cesium.Math.toRadians(-35.0);
    //pitch = scene.camera.pitch;
    Range = 474;
  } else {
    pitch = Cesium.Math.toRadians(pitchcsh);
    //pitch = scene.camera.pitch;
    Range = range1;
  }
  var transform = Cesium.Transforms.eastNorthUpToFixedFrame(
    Cesium.Cartesian3.fromDegrees(
      center.x + 0.00000000001114,
      center.y,
      tranheight + 10
    )
  );
  var heading = Cesium.Math.toRadians(lpheading);

  //var pitch = Cesium.Math.toRadians(-5.0);
  var range2 = Range;
  scene.camera.lookAtTransform(
    transform,
    new Cesium.HeadingPitchRange(heading, pitch, range2)
  );
}
/**
 * 功能：根据选中房源面积和楼层高低按钮后，显示出符合条件的房源信息和三维中符合条件的房源变红色
 */
var arraydi = [],
  arrayzhong = [],
  arraygao = [],
  arrayxiao = [],
  arrayzhon = [],
  arrayda = [],
  arraychaogao = [];
function change(val) {
  $("#page").empty();
  var temp = "";
  var arrayli = $("#mianji a");
  for (var i = 0; i < arrayli.length; i++) {
    if (arrayli[i].className == "active") {
      temp = arrayli[i].id;
    }
  }
  var temp1 = "";
  var arrayli1 = $("#louceng a");
  for (var i = 0; i < arrayli1.length; i++) {
    if (arrayli1[i].className == "active") {
      temp1 = arrayli1[i].id;
    }
  }
  $("#listfjh").empty();
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].floor <= 6) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arraydi.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].area < 200) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arrayxiao.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].area >= 200 && resu1.data.list[i].area < 800) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arrayzhon.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].area > 800) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arrayda.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].floor >= 7 && resu1.data.list[i].floor <= 15) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arrayzhong.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].floor >= 16 && resu1.data.list[i].floor <= 30) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arraygao.push(f);
      }
    }
  }
  for (var i = 0; i < resu1.data.list.length; i++) {
    if (resu1.data.list[i].floor >= 30) {
      var ar = [];
      ar.push(resu1.data.list[i].roomNo);
      for (var j = 0; j < ar.length; j++) {
        var f = ar[j];
        arraychaogao.push(f);
      }
    }
  }
  arraydi = unique(arraydi);
  arrayzhong = unique(arrayzhong);
  arraygao = unique(arraygao);
  arrayxiao = unique(arrayxiao);
  arrayzhon = unique(arrayzhon);
  arrayda = unique(arrayda);
  arraychaogao = unique(arraychaogao);
  if (val.id == "di") {
    $("#gao").removeClass("active");
    $("#chaogao").removeClass("active");
    $("#zhong").removeClass("active");
    if ($("#di").hasClass("active")) {
      $("#di").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp == "xiao") {
          cxjg(arrayxiao);
        } else if (temp == "zhon") {
          cxjg(arrayzhon);
        } else if (temp == "da") {
          cxjg(arrayda);
        }
      }
    } else {
      $("#di").addClass("active");
      if ($("#count li .active").size() == 1) {
        cxjg(arraydi);
      } else {
        if (temp == "xiao") {
          var c = [];
          c = arrayIntersection(arraydi.sort(), arrayxiao.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp == "zhon") {
          var c = [];
          c = arrayIntersection(arrayzhon.sort(), arraydi.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp == "da") {
          var c = [];
          c = arrayIntersection(arrayda.sort(), arraydi.sort());
          var arr = unique(c);

          cxjg(arr);
        }
      }
    }
  } else if (val.id == "zhong") {
    $("#chaogao").removeClass("active");
    $("#gao").removeClass("active");
    $("#di").removeClass("active");
    if ($("#zhong").hasClass("active")) {
      $("#zhong").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp == "xiao") {
          cxjg(arrayxiao);
        } else if (temp == "zhon") {
          cxjg(arrayzhon);
        } else if (temp == "da") {
          cxjg(arrayda);
        }
      }
    } else {
      $("#zhong").addClass("active");
      if ($("#count li .active").size() == 1) {
        cxjg(arrayzhong);
      } else {
        if (temp == "xiao") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arrayzhong.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp == "zhon") {
          var c = [];
          c = arrayIntersection(arrayzhon.sort(), arrayzhong.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp == "da") {
          var c = [];
          c = arrayIntersection(arrayzhong.sort(), arrayda.sort());
          var arr = unique(c);

          cxjg(arr);
        }
      }
    }
  } else if (val.id == "gao") {
    $("#chaogao").removeClass("active");
    $("#zhong").removeClass("active");
    $("#di").removeClass("active");
    if ($("#gao").hasClass("active")) {
      $("#gao").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp == "xiao") {
          cxjg(arrayxiao);
        } else if (temp == "zhon") {
          cxjg(arrayzhon);
        } else if (temp == "da") {
          cxjg(arrayda);
        }
      }
    } else {
      $("#gao").addClass("active");
      if ($("#count li .active").size() == 1) {
        cxjg(arraygao);
      } else {
        if (temp == "xiao") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arraygao.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp == "zhon") {
          var c = [];
          c = arrayIntersection(arrayzhon.sort(), arraygao.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp == "da") {
          var c = [];
          c = arrayIntersection(arrayda.sort(), arraygao.sort());
          var arr = unique(c);

          cxjg(arr);
        }
      }
    }
  } else if (val.id == "chaogao") {
    $("#gao").removeClass("active");
    $("#zhong").removeClass("active");
    $("#di").removeClass("active");
    if ($("#chaogao").hasClass("active")) {
      $("#chaogao").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp == "xiao") {
          cxjg(arrayxiao);
        } else if (temp == "zhon") {
          cxjg(arrayzhon);
        } else if (temp == "da") {
          cxjg(arrayda);
        }
      }
    } else {
      $("#chaogao").addClass("active");
      if ($("#count li .active").size() == 1) {
        cxjg(arraychaogao);
      } else {
        if (temp == "xiao") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arraychaogao.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp == "zhon") {
          var c = [];
          c = arrayIntersection(arrayzhon.sort(), arraychaogao.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp == "da") {
          var c = [];
          c = arrayIntersection(arrayda.sort(), arraychaogao.sort());
          var arr = unique(c);

          cxjg(arr);
        }
      }
    }
  } else if (val.id == "xiao") {
    $("#zhon").removeClass("active");
    $("#da").removeClass("active");
    if ($("#xiao").hasClass("active")) {
      $("#xiao").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp1 == "di") {
          cxjg(arraydi);
        } else if (temp1 == "zhong") {
          cxjg(arrayzhong);
        } else if (temp1 == "gao") {
          cxjg(arraygao);
        } else if (temp1 == "chaogao") {
          cxjg(arraychaogao);
        }
      }
    } else {
      $("#xiao").addClass("active");
      if ($("#count li .active").size() == 1) {
        cxjg(arrayxiao);
      } else {
        if (temp1 == "di") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arraydi.sort());
          var arr = unique(c);
          cxjg(arr);
        } else if (temp1 == "zhong") {
          var c = [];
          c = arrayIntersection(arrayxiao.sort(), arrayzhong.sort());
          var arr = unique(c);
          cxjg(arr);
        } else if (temp1 == "gao") {
          var c = [];
          c = arrayIntersection(arraygao.sort(), arrayxiao.sort());
          var arr = unique(c);
          cxjg(arr);
        } else if (temp1 == "chaogao") {
          var c = [];
          c = arrayIntersection(arraychaogao.sort(), arrayxiao.sort());
          var arr = unique(c);
          cxjg(arr);
        }
      }
    }
  } else if (val.id == "zhon") {
    $("#xiao").removeClass("active");
    $("#da").removeClass("active");
    if ($("#zhon").hasClass("active")) {
      $("#zhon").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp1 == "zhong") {
          cxjg(arrayzhong);
        } else if (temp1 == "di") {
          cxjg(arraydi);
        } else if (temp1 == "gao") {
          cxjg(arraygao);
        } else if (temp1 == "chaogao") {
          cxjg(arraychaogao);
        }
      }
    } else {
      $("#zhon").addClass("active");
      if ($("#count li .active").size() == 1) {
        cxjg(arrayzhon);
      } else {
        if (temp1 == "di") {
          var c = [];
          c = arrayIntersection(arraydi.sort(), arrayzhon.sort());
          var arr = unique(c);
          cxjg(arr);
        } else if (temp1 == "zhong") {
          var c = [];
          c = arrayIntersection(arrayzhong.sort(), arrayzhon.sort());
          var arr = unique(c);
          cxjg(arr);
        } else if (temp1 == "gao") {
          var c = [];
          c = arrayIntersection(arraygao.sort(), arrayzhon.sort());
          var arr = unique(c);
          cxjg(arr);
        } else if (temp1 == "chaogao") {
          var c = [];
          c = arrayIntersection(arraygao.sort(), arrayzhon.sort());
          var arr = unique(c);
          cxjg(arr);
        }
      }
    }
  } else if (val.id == "da") {
    $("#xiao").removeClass("active");
    $("#zhon").removeClass("active");
    if ($("#da").hasClass("active")) {
      $("#da").removeClass("active");
      if ($("#count li .active").size() == 0) {
        fy();
      } else {
        if (temp1 == "di") {
          cxjg(arraydi);
        } else if (temp1 == "zhong") {
          cxjg(arrayzhong);
        } else if (temp1 == "gao") {
          cxjg(arraygao);
        } else if (temp1 == "chaogao") {
          cxjg(arraychaogao);
        }
      }
    } else {
      $("#da").addClass("active");
      if ($("#count li .active").size() == 1) {
        cxjg(arrayda);
      } else {
        if (temp1 == "di") {
          var c = [];
          c = arrayIntersection(arraydi.sort(), arrayda.sort());
          var arr = unique(c);
          cxjg(arr);
        } else if (temp1 == "zhong") {
          var c = [];
          c = arrayIntersection(arrayzhong.sort(), arrayda.sort());
          //c = Array.intersect(arrayzhong.uniquelize(), arrayda.uniquelize());
          var arr = unique(c);
          cxjg(arr);
        } else if (temp1 == "gao") {
          var c = [];
          c = arrayIntersection(arraygao.sort(), arrayda.sort());
          var arr = unique(c);

          cxjg(arr);
        } else if (temp1 == "chaogao") {
          var c = [];
          c = arrayIntersection(arraychaogao.sort(), arrayda.sort());
          var arr = unique(c);
          cxjg(arr);
        }
      }
    }
  }
}
function unique(arr) {
  // 遍历arr，把元素分别放入tmp数组(不存在才放)
  var tmp = new Array();
  for (var i in arr) {
    //该元素在tmp内部不存在才允许追加
    if (tmp.indexOf(arr[i]) == -1) {
      tmp.push(arr[i]);
    }
  }
  return tmp;
}

//点击面积、楼层、查询结果
function cxjg(arraydi) {
  var arraydi1 = unique(arraydi);
  roomNo = [];
  var imgurl1 = fwurl + "/image/";
  $("#fjhlist").empty();
  if (arraydi1.length == 0 && promisehouse != undefined) {
    promisehouse.then(function(layer) {
      layer.visible = true;
      layer.setObjsVisible([-1], true);
      layer.setObjsColor([-1], new Cesium.Color(0, 139 / 255, 210 / 255, 1));
    });
    $("#nolist").css({ display: "block" });
    $("#havelist").css({ display: "none" });
  } else {
    $("#nolist").css({ display: "none" });
    $("#havelist").css({ display: "block" });
  }
  if (arraydi1.length > 0 && promisehouse != undefined) {
    gethousehold(arraydi1);
    setTimeout(function() {
      for (var j = 0; j < arraydi1.length; j++) {
        for (var i = 0; i < resu1.data.list.length; i++) {
          if (resu1.data.list[i] != undefined) {
            if (resu1.data.list[i].roomNo == arraydi1[j]) {
              var temp = resu1.data.list[i].releaseTime;
              var time;
              if (temp != null) {
                time = temp.substring(0, temp.length - 9);
              } else {
                time = "";
              }
              var fjh1 = array[j];
              var imglj;
              if (
                resu1.data.list[i].imgUrl == null ||
                resu1.data.list[i].imgUrl == "null"
              ) {
                imglj = "static/images/noupload.png";
              } else {
                imglj = imgurl1 + resu1.data.list[i].imgUrl;
              }
              var list = [];
              var zbtjll;
              for (var n = 0; n < resu1.data.list.length; n++) {
                list.push(resu1.data.list[n].houseId);
              }
              ajax(
                "/api/v1/user/opt/countVisits",
                "POST",
                { ids: list, type: "3" },
                function(result) {
                  if (result.code == 200) {
                    zbtjll = result;
                  }
                },
                false
              );
              var area = resu1.data.list[i].area;
              for (var m = 0; m < array1.length; m++) {
                if (resu1.data.list[i].roomNo == array1[m]) {
                  var fjh1 = array[m];
                  $("#fjhlist").append(
                    '<div class="swiper-slide" id="' +
                      fjh1 +
                      '" onclick="fyxq(' +
                      resu1.data.list[i].houseId +
                      ',this);">' +
                      '<div class="details">' +
                      '<div class="pic">' +
                      '<img src="' +
                      imglj +
                      '" style="display: inline;">' +
                      "</div>" +
                      '<div class="remark aui-clearfix">' +
                      '<div class="line-1 aui-clearfix">' +
                      '<div class="pull-left"><a href="javascript:;">' +
                      resu1.data.list[i].area +
                      "m²｜" +
                      resu1.data.list[i].floor +
                      "层</a></div>" +
                      '<div class="pull-right">' +
                      '<span class="zhizu-plan"><small>直租计划</small></span>' +
                      "</div>" +
                      "</div>" +
                      '<div class="aui-clearfix detail-info">' +
                      '<div class="pull-left" style="padding-top:.1rem;">浏览量<small></small>' +
                      zbtjll.data[i].count +
                      "</div>" +
                      '<div class="pull-right">' +
                      "<small>约</small><big>" +
                      ((resu1.data.list[i].price * 30 * area) / 10000).toFixed(
                        1
                      ) +
                      "</big>" +
                      "<small>万/月</small>" +
                      "</div>" +
                      "</div>" +
                      "</div>" +
                      "</div>" +
                      "</div>"
                  );
                }
              }
            }
          }
        }
      }
      promisehouse.then(function(layer) {
        if (array > 0) {
          layer.visible = true;
        }
        layer.setObjsVisible(array, true);
        layer.setObjsColor(array, new Cesium.Color(0, 139 / 255, 210 / 255, 1));
      });
    }, 300);
  } else {
    for (var j = 0; j < arraydi1.length; j++) {
      for (var i = 0; i < resu1.data.list.length; i++) {
        if (resu1.data.list[i] != undefined) {
          if (resu1.data.list[i].roomNo == arraydi1[j]) {
            var temp = resu1.data.list[i].releaseTime;
            var time;
            if (temp != null) {
              time = temp.substring(0, temp.length - 9);
            } else {
              time = "";
            }
            var fjh1 = array[j];
            var imglj;
            if (
              resu1.data.list[i].imgUrl == null ||
              resu1.data.list[i].imgUrl == "null"
            ) {
              imglj = "static/images/noupload.png";
            } else {
              imglj = imgurl1 + resu1.data.list[i].imgUrl;
            }
            var list = [];
            var zbtjll;
            for (var n = 0; n < resu1.data.list.length; n++) {
              list.push(resu1.data.list[n].houseId);
            }
            ajax(
              "/api/v1/user/opt/countVisits",
              "POST",
              { ids: list, type: "3" },
              function(result) {
                if (result.code == 200) {
                  zbtjll = result;
                }
              },
              false
            );
            var area = resu1.data.list[i].area;
            for (var m = 0; m < array1.length; m++) {
              if (resu1.data.list[i].roomNo == array1[m]) {
                var fjh1 = array[m];
                $("#fjhlist").append(
                  '<div class="swiper-slide" id="' +
                    fjh1 +
                    '" onclick="fyxq(' +
                    resu1.data.list[i].houseId +
                    ',this);">' +
                    '<div class="details">' +
                    '<div class="pic">' +
                    '<img src="' +
                    imglj +
                    '" style="display: inline;">' +
                    "</div>" +
                    '<div class="remark aui-clearfix">' +
                    '<div class="line-1 aui-clearfix">' +
                    '<div class="pull-left"><a href="javascript:;">' +
                    resu1.data.list[i].area +
                    "m²｜" +
                    resu1.data.list[i].floor +
                    "层</a></div>" +
                    '<div class="pull-right">' +
                    '<span class="zhizu-plan"><small>直租计划</small></span>' +
                    "</div>" +
                    "</div>" +
                    '<div class="aui-clearfix detail-info">' +
                    '<div class="pull-left" style="padding-top:.1rem;">浏览量<small></small>' +
                    zbtjll.data[i].count +
                    "</div>" +
                    '<div class="pull-right">' +
                    "<small>约</small><big>" +
                    ((resu1.data.list[i].price * 30 * area) / 10000).toFixed(
                      1
                    ) +
                    "</big>" +
                    "<small>万/月</small>" +
                    "</div>" +
                    "</div>" +
                    "</div>" +
                    "</div>" +
                    "</div>"
                );
              }
            }
          }
        }
      }
    }
  }
}
//点击房源信息跳转房源页面联系
function fyxq(houseid, hsid) {
  window.open(
    "household.html?name=" +
      commname +
      "&hsid=" +
      hsid.id +
      "&houseid=" +
      houseid +
      "&buildid=" +
      buildid,
    "_blank"
  );
}
//查询出房源信息
function fy() {
  if (commname != "" || dzc_service != undefined) {
    gethousehold(arrayallguid);
  }

  setTimeout(function() {
    ajax(
      "/api/v1/building/buildingHomeRentSpace",
      "POST",
      { buildingId: buildid, page: "1", size: "9900" },
      function(result) {
        if (result.code == 200) {
          var list = [];
          var zbtjll;
          for (var j = 0; j < result.data.list.length; j++) {
            list.push(result.data.list[j].houseId);
          }
          ajax(
            "/api/v1/user/opt/countVisits",
            "POST",
            { ids: list, type: "3" },
            function(result) {
              if (result.code == 200) {
                zbtjll = result;
              }
            },
            false
          );
          $("#fjhlist").empty();
          if (result.data.list.length == 0) {
            $("#nolist").css({ display: "block" });
            $("#havelist").css({ display: "none" });
          } else {
            $("#nolist").css({ display: "none" });
            $("#havelist").css({ display: "block" });
          }

          for (var i = 0; i < result.data.list.length; i++) {
            if (commname != "" || dzc_service != undefined) {
              if (array1 != undefined) {
                for (var m = 0; m < array1.length; m++) {
                  if (result.data.list[i].roomNo == array1[m]) {
                    var fjh1 = array[m];
                  }
                }
              }
            } else {
              var fjh1 = result.data.list[i].houseId;
            }
            var area = resu1.data.list[i].area;

            $("#fjhlist").append(
              '<div class="swiper-slide" id="' +
                fjh1 +
                '" onclick="fyxq(' +
                result.data.list[i].houseId +
                ',this);">' +
                '<div class="details">' +
                '<div class="pic">' +
                '<img src="' +
                getDefaultImg(result.data.list[i].imgUrl) +
                '" style="display: inline;">' +
                "</div>" +
                '<div class="remark aui-clearfix">' +
                '<div class="line-1 aui-clearfix">' +
                '<div class="pull-left"><a href="javascript:;">' +
                result.data.list[i].area +
                "m²｜" +
                result.data.list[i].floor +
                "层</a></div>" +
                '<div class="pull-right">' +
                '<span class="zhizu-plan"><small>直租计划</small></span>' +
                "</div>" +
                "</div>" +
                '<div class="aui-clearfix detail-info">' +
                '<div class="pull-left" style="padding-top:.1rem;"><small>浏览量</small>' +
                zbtjll.data[i].count +
                "</div>" +
                '<div class="pull-right">' +
                "<small>约</small><big>" +
                ((result.data.list[i].price * 30 * area) / 10000).toFixed(1) +
                "</big>" +
                "<small>万/月</small>" +
                "</div>" +
                "</div>" +
                "</div>" +
                "</div>" +
                "</div>"
            );
          }
        } else {
          alert("失败！！！");
        }
      },
      false
    );
    if (promisehouse != "" && promisehouse != undefined) {
      promisehouse.then(function(layer) {
        if (array.length > 0) {
          layer.visible = true;
          layer.setObjsVisible(array, true);
          layer.setObjsColor(
            array,
            new Cesium.Color(0, 139 / 255, 210 / 255, 1)
          );
        } else {
          layer.visible = true;
          layer.setObjsVisible([-1], true);
          layer.setObjsColor(
            [-1],
            new Cesium.Color(0, 139 / 255, 210 / 255, 1)
          );
        }
      });
    }
  }, 100);
}
//求两个数组的交集
function arrayIntersection(a, b) {
  var ai = 0,
    bi = 0;
  var result = new Array();
  while (ai < a.length && bi < b.length) {
    if (a[ai] < b[bi]) {
      ai++;
    } else if (a[ai] > b[bi]) {
      bi++;
    } /* they're equal */ else {
      result.push(a[ai]);
      ai++;
      bi++;
    }
  }
  return result;
}
